<!--
 * @Author: 曹捷
 * @Date: 2020-06-24 16:36:24
 * @LastEditors: 曹捷
 * @LastEditTime: 2020-09-04 09:59:39
 * @Description: 系统回复详情页面，回复子模块，单个人回复
--> 
<template>
  <div class="list-item question-content">
    <div class="list-body">
      <div class="flex-l">
        <obitImage
          :src="detailsInfo.photoUrl"
          @click="$app.toUserCenter(detailsInfo.commentUserId,detailsInfo.commentName)"
          class="list-item-img"
          type="man"
        />
        <div class="flex1">
          <div class="q-name flex-l-r">
            <span @click="$app.toUserCenter(detailsInfo.commentUserId,detailsInfo.commentName)" class="obit-link">{{detailsInfo.commentName}}</span>
            <span v-if="type==='question'">
              <span class="obit-zlbtn obit-zlbtn-defult p-b-0" v-if="detailsInfo.isBest">最佳回复</span>
            </span>
            <span>
              <span @click="moreInfo" class="iconfont icon-bottom" style="color:#bbb;"></span>
            </span>
          </div>
          <div @click="toComment" class="back-main content color-info p-b-10 textarea-info">
            <span class="relation" v-if="detailsInfo.relationName && detailsInfo.superiorCommentId !==detailsInfo.relationCommentId">
              回复
              <span
                @click.stop="$app.toUserCenter(detailsInfo.relationUserId,detailsInfo.relationName)"
                class="obit-link p-l-5"
              >{{detailsInfo.relationName}}：</span>
            </span>
            <span v-html="detailsInfo.comment"></span>
          </div>
          <div class="image-content">
            <image
              :key="'cim'+index"
              :src="item.compressFileUrl"
              @click="$app.toshowImg(index,detailsInfo.fileList)"
              class="question-img"
              mode="aspectFill"
              v-for="(item,index ) in detailsInfo.fileList"
            />
            <div :key="i" class="question-bak" v-for="i in 2"></div>
          </div>
          <div class="back-content" v-if="backType ===1 &&detailsInfo.childCommentCount>0">
            <span @click="toquesBack">
              共 {{detailsInfo.childCommentCount}}条回复
              <span class="iconfont icon-right1"></span>
            </span>
          </div>
          <div class="ques-back-foot flex-l-r p-t-5">
            <span class="obit-info">{{detailsInfo.createTime}}</span>
            <!-- <span class="back-item" v-if="backType ===1">
                <span class="iconfont icon-chakansvg p-r-5"></span>
                4221
            </span>-->
            <slot name="btns"></slot>
            <!-- <span class="back-item">
                <span class="iconfont icon-good p-r-5"></span>
                562
              </span>
              <span @click="toComment" class="back-item" v-if="backType ===1">
                <span class="iconfont icon-msg"></span>
            </span>-->
            <!-- <span class="back-item">
                213
                <span class="iconfont icon-msg"></span>
            </span>-->
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    detailsInfo: {
      type: Object,
    },
    // question     focus
    type: {
      type: String,
    },
    // 页面类型 1问题回复页面  2回复二级回复页面
    backType: {
      type: Number,
      default: 1,
    },
    mainInfo: {
      type: Object,
    },
  },
  data() {
    return {
      hasFocus: false,
    }
  },
  created() {
    this.hasFocus = this.detailsInfo.focusFlag === 1
  },
  methods: {
    toquesBack() {
      let param = {
        mainDataId: this.mainInfo.dataId,
        belongUserId: this.mainInfo.createBy,
        superiorCommentId: this.detailsInfo.commentDetailId,
        num: this.detailsInfo.childCommentCount,
        type: this.type,
      }
      let info = this.$util.util.cloneObj(this.detailsInfo)
      this.$app.goto(
        '/pages/question/quesDetails/quesBackDetails',
        Object.assign(info, param)
      )
    },
    moreInfo() {
      this.$emit('moreInfo', this.detailsInfo)
    },
    cancleFocus() {
      uni.showModal({
        title: '取消关注',
        content: '您确定要取消关注此问题吗？',
        success: (res) => {
          if (res.confirm) {
            this.hasFocus = false
          } else if (res.cancel) {
            console.log('用户点击取消')
          }
        },
      })
    },

    toComment() {
      this.$emit('comment')
    },
  },
}
</script>

<style>
</style>
